package com.wzy.tools.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;

/**
 * @author Weizhengyun
 * @desc
 * @date 2022/12/17 上午11:31
 */
@Component
@Aspect
@Slf4j
public class MethodCheckerAspect {

    @Around("@annotation(methodChecker)")
    public Object around(ProceedingJoinPoint pjp, MethodChecker methodChecker) {
        try {
            Class<?> clazz = pjp.getClass();
            log.info("将执行 " + pjp.getTarget().getClass().getName() + " 类的 " + pjp.getSignature().getName() + " 方法");
            return pjp.proceed();
        } catch (Throwable e) {
            throw new RuntimeException(e);
        }
    }

}
